#    LOL Man pages
#    Copyright (C) 2010  kishore@logonlinux.com
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

from google.appengine.ext import db

#basic info for the man page
class BasicInfo(db.Model):
	description    = db.TextProperty()
	usage          = db.TextProperty()    
	examples	   = db.TextProperty()

#advacned info for the man page
class AdvancedInfo(db.Model):
	description    = db.TextProperty()
	usage          = db.TextProperty()    
	examples	   = db.TextProperty()

# Man page
class ManPage(db.Model):
	name                = db.StringProperty(required=True)
	basicInfo           = db.ReferenceProperty(BasicInfo)
	advancedInfo        = db.ReferenceProperty(AdvancedInfo)
	manPage				= db.SelfReferenceProperty(collection_name="relatedPages")
	debUrl				= db.LinkProperty()
	rpmUrl				= db.LinkProperty()
	debInstallation     = db.TextProperty()
	rpmInstallation     = db.TextProperty()

#author    
class Author(db.Model):
	name    = db.StringProperty(required=True)
	emailId = db.EmailProperty()
	webPage = db.LinkProperty()
	
# author and pages association many to many
class AuthorPage(db.Model):
	author = db.ReferenceProperty(Author,required=True,collection_name='manPages')
	manPage = db.ReferenceProperty(ManPage,required=True,collection_name='authors')
